<template>
  <div id="app">
    <Header />
    <div class="main-container">
      <!-- 动态显示侧边栏 -->
      <DynamicSidebar v-if="showSidebar" />
      <div class="content">
        <router-view />
      </div>
    </div>
    <Footer />
  </div>
</template>

<script setup>
import { computed } from 'vue';
import { useRoute } from 'vue-router';
import { useAuthStore } from '@/stores/auth';
import Header from '@/components/Header.vue';
import Footer from '@/components/Footer.vue';
import DynamicSidebar from '@/components/DynamicSidebar.vue';

const authStore = useAuthStore();
const route = useRoute();

// 计算属性控制侧边栏显示
const showSidebar = computed(() => {
  // 登录页面不显示侧边栏
  if (route.path === '/login') return false;
  
  // 已登录用户显示侧边栏
  return authStore.isAuthenticated;
});
</script>

<style>
/* 原有样式保持不变 */
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #2c3e50;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-container {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.content {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}
</style>